﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ScheduleUtil
{
    /// <summary>
    /// 一天的时间表
    /// </summary>
    public class DayTimesFlag
    {
        /// <summary>
        /// 多段开始结束时间段
        /// </summary>
        public List<TimeFlag> timeFlags { get; set; } = new List<TimeFlag>();
        /// <summary>
        /// 判断是否在当天时间表内
        /// </summary>
        /// <param name="addMinute"></param>
        /// <param name="subMinute"></param>
        /// <returns></returns>
        public bool InBroadcasTime(int addMinute = 0, int subMinute = 0)
        {
            foreach (TimeFlag timeFlag in timeFlags)
            {
                if (timeFlag.TimeIn(addMinute, subMinute))
                {
                    return true;
                }
            }
            return false;
        }
    }
}
